package week2nd;

import java.util.Scanner;
import java.util.StringTokenizer;

public class intlist {
    public static void main(String[] args) {
        IntNodeList inl = new IntNodeList();

        System.out.println("输入整数，由空格分开");
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();

        int a = 0;

        StringTokenizer st = new StringTokenizer(string, " ");

        while (st.hasMoreElements()) {
            a = Integer.parseInt(st.nextToken());
            inl.add(a);
        }

        System.out.print("排序后: ");
        inl.Sort();
        System.out.println(inl);

        System.out.print("删除\"2\": ");
        inl.delete(2);
        System.out.println(inl);

        System.out.print("在第三位插入\"8\": ");
        inl.insert(3, 8);
        System.out.println(inl);

        System.out.print("(头插法加入\"9\"): ");
        inl.HeadInsert(9);
        System.out.println(inl);
    }
}
